﻿<%@ Page Title="Manage Products | Hardwares-R-Us" Language="C#" Theme="Admin_User_Theme"
    MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="ManageProducts.aspx.cs"
    Inherits="WDTAsg2.Admin.WebForm1" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>
        Product Management Page</h1>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <p>
        <asp:ListView ID="lvProducts" runat="server" OnItemEditing="lvProducts_ItemEditing"
            OnItemUpdating="lvProducts_ItemUpdating" OnItemCanceling="lvProducts_ItemCanceling"
            InsertItemPosition="FirstItem" OnItemInserting="lvProducts_ItemInserting" OnItemDeleting="lvProducts_ItemDeleting">
            <LayoutTemplate>
                <table runat="server" clientidmode="Static" id="tblProducts">
                    <tr id="Tr1" runat="server">
                        <th id="Th1" runat="server">
                            Title
                        </th>
                        <th id="Th2" runat="server">
                            TagLine
                        </th>
                        <th id="Th3" runat="server">
                            Description
                        </th>
                        <th id="Th4" runat="server">
                            Category
                        </th>
                        <th id="Th5" runat="server">
                            Image
                        </th>
                        <th id="Th6" clientidmode="Static" runat="server">
                            Keywords
                        </th>
                    </tr>
                    <tr runat="server" id="itemPlaceholder" />
                </table>
            </LayoutTemplate>
            <ItemTemplate>
                <tr runat="server">
                    <td>
                        <asp:Label ID="ProductIdLabel" runat="server" Text='<%# Eval("ProductId") %>' Visible="false" />
                        <asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
                    </td>
                    <td>
                        <asp:Label ID="TagLineLabel" runat="server" Text='<%# Eval("TagLine") %>' />
                    </td>
                    <td>
                        <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' />
                    </td>
                    <td>
                        <asp:Label ID="CategoryId" runat="server" Text='<%# Eval("CategoryId") %>' />
                    </td>
                    <td>
                        <asp:Image ID="ProductImage" CssClass="tinyimg" ImageUrl='<%# Eval("ImageUrl") %>'
                            runat="server" />
                    </td>
                    <td class="keywords">
                        <asp:Label ID="Keywords" runat="server" Text='<%# Eval("Keywords") %>' />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                        <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Do you want to delete?')" />
                    </td>
                </tr>
            </ItemTemplate>
            <EditItemTemplate>
                <tr>
                    <td>
                        <asp:Label ID="ProductIdLabel" Visible="false" runat="server" Text='<%# Bind("ProductId") %>' />
                        <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="TagLineTextBox" runat="server" Text='<%# Bind("TagLine") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>' />
                    </td>
                    <td>
                        <asp:DropDownList ID="ddCategoryId" DataValueField="CategoryId" DataSourceID="odsCategories"
                            DataTextField="Description" SelectedValue='<%# Bind("CategoryId") %>' runat="server" />
                    </td>
                    <td>
                        <asp:TextBox ID="ImageUrlTextBox" runat="server" Text='<%# Bind("ImageUrl") %>' />
                    </td>
                    <td class="keywords">
                        <asp:TextBox ID="KeywordsTextBox" runat="server" Text='<%# Bind("Keywords") %>' />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                    </td>
                </tr>
            </EditItemTemplate>
            <InsertItemTemplate>
                <tr>
                    <td>
                        <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="TagLineTextBox" runat="server" Text='<%# Bind("TagLine") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>' />
                    </td>
                    <td>
                        <asp:DropDownList ID="ddCategoryId" DataValueField="CategoryId" DataSourceID="odsCategories"
                            DataTextField="Description" SelectedValue='<%# Bind("CategoryId") %>' runat="server" />
                    </td>
                    <td>
                        <asp:TextBox ID="ImageUrlTextBox" runat="server" Text='<%# Bind("ImageUrl") %>' />
                    </td>
                    <td class="keywords">
                        <asp:TextBox ID="KeywordsTextBox" runat="server" Text='<%# Bind("Keywords") %>' />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
                    </td>
                </tr>
            </InsertItemTemplate>
        </asp:ListView>
        <asp:ObjectDataSource ID="odsCategories" runat="server" SelectMethod="GetAllChildCategories"
            TypeName="WDTAsg2.DbBizObject.CategoryInfo"></asp:ObjectDataSource>
        <br />
    </p>
</asp:Content>
